IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MachineEnvVar]') AND type in (N'U'))
BEGIN
     DROP TABLE [dbo].[MachineEnvVar]
END
GO

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[MachineEnvVar](
     [MachineId]          [int]           NOT NULL,
     [MachineEnvVarId]    [int]           NOT NULL,
     [StartDt]            [datetime]      NOT NULL,
     [EndDt]              [datetime]      NOT NULL,
     [CurrentRecordFlag]  [tinyint]       NOT NULL CONSTRAINT [DF_MachineEnvVar_CurrentRecordFlag]  DEFAULT ((0)),
     [PackageExecutionId] [bigint]        NOT NULL,
     [VarDeletedFlag]     [tinyint]       NOT NULL,
     [VarName]            [varchar](100)  NOT NULL,
     [VarUser]            [varchar](128)  NOT NULL,
     [VarVal]             [varchar](7680)     NULL,
     CONSTRAINT [PK_MachineEnvVar] PRIMARY KEY CLUSTERED ( [MachineId] ASC, [MachineEnvVarId] ASC, [StartDt] ASC )
) ON [PRIMARY]
GO

SET ANSI_PADDING OFF
GO
